<?php
	require_once("conexion/conexion.php");
	function BuscaAnalisis($sustancia)
	{
		$con = new Conexion();
		$con2 = $con->conexionBD("fpproduccion");
		$sql="select TSusNombre from tiposustancia inner join sustancia on sustancia.suscod=tiposustancia.suscod where tiposustancia.suscod='".$sustancia."' order by TSusNombre asc";
		$res= mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
		$fila = mysql_num_rows($res);
		$con->cerrarBD();
		$cadena = "";
		$aux=0;
		while($reg = mysql_fetch_array($res))
		{
			if($aux==0)
			{
				$aux=1;
				$cadena = $reg['TSusNombre'];
			}
			else
			{
				$cadena = $cadena."<br>".$reg['TSusNombre'];
			}
		}
		
		return $cadena;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<link href="Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />

<script src="include_js/jquery.js" type="text/javascript"></script>
</head>

<body>
<form name="analisis" id="analisis" method="post">
<?php
		$con = new Conexion();
		$con2 = $con->conexionBD("fpproduccion");
		$sql="select SusNombre,SusCod from sustancia";
		$res= mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
		$con->cerrarBD();
?>
<div style="height:5px"></div>
<div class='option2'><label style="font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;">Tipo de An&aacute;lisis Ingresados.</label><div style="display:inline; margin-left:510px;"><img src="imagen/cerrar.png" width="16" height="16" onclick="CerrarDatos();" style="cursor: pointer; border: 1px solid #990000;" alt="Cerrar" /></div></div>
 <div class="cabecera">
   <table class="fija" border="0" cellpadding="0" cellspacing="0">
      <thead class="fija">
      	<tr class="fija">
      	  <th width="36%" class="fija">tipo analisis</th>
      	  <th width="64%" class="fija">analisis</th>
      	</tr>
      </thead>
      <tbody class="fija">
	  <tr class="fija"><td colspan="2" class="fija">&nbsp;</td></tr>
	  <?php
		$aux = 1;
		while($reg = mysql_fetch_array($res))
		{
			$analisis = BuscaAnalisis($reg['SusCod']);
			if(($aux % 2)==0)
			{
				echo "<tr class='filaImpar' id='".$aux."'>";
				echo "<td width=\"36%\" style='text-align:lefth;padding-left:50px;'>".$reg['SusNombre']."</td>";
				echo "<td width=\"64%\" style='text-align:lefth;padding-left:120px;'>".$analisis."</td>";
				echo "</tr>";
			}
			else
			{
				echo "<tr class='filaPar' id='".$aux."'>";
				echo "<td width=\"36%\" style='text-align:lefth;padding-left:50px;'>".$reg['SusNombre']."</td>";
				echo "<td width=\"64%\" style='text-align:lefth;padding-left:120px;'>".$analisis."</td>";
				echo "</tr>";
			}
			$aux++;
		}
	?>
      </tbody>
   </table>       
</div>
</form>
</body>
</html>
